

class Solution(object):
    def mySqrt(self, x):
        """
        :type x: int
        :rtype: int
        """
        left = 0
        right = x
        ans = -1
        while left <= right:
            mid = (left+right) // 2
            if mid*mid <= x:
                ans = mid
                left = mid + 1
            else:
                r = mid - 1
        print(ans)


if __name__ == '__main__':
    sol = Solution()
    sol.mySqrt(5)
